﻿var Prefix = "ctl00_ctl00_ContentPlaceHolder3_ContentPlaceHolder1_";



function Get(elementName){
    return(document.getElementById(elementName));
}

function MinBoxValueChange(AreaName) {
    var MinValue = Get(Prefix + AreaName + "MinTextBox").value;
    var MaxValue = Get(Prefix + AreaName + "MaxTextBox").value;
    if (MinValue <= MaxValue) {
        $("#" + AreaName + "Slider").slider("values", 0, MinValue);
    }
    else {
        Get(Prefix + AreaName + "MinTextBox").value = $("#" + AreaName + "Slider").slider("values", 0);
    }
}

function MaxBoxValueChange(AreaName) {
    var MinValue = Get(Prefix + AreaName + "MinTextBox").value;
    var MaxValue = Get(Prefix + AreaName + "MaxTextBox").value;
    if (MinValue <= MaxValue) {
        $("#" + AreaName + "Slider").slider("values", 1, MaxValue);
    }
    else {
        Get(Prefix + AreaName + "MaxTextBox").value = $("#" + AreaName + "Slider").slider("values", 1);
    }
}

$(function () {
    var InstinctsMinSliderValue, InstinctsMaxSliderValue;
    InstinctsMinSliderValue = document.getElementById(Prefix + "InstinctsMinTextBox").value;
    InstinctsMaxSliderValue = document.getElementById(Prefix + "InstinctsMaxTextBox").value;
    var GoalkeepingMinSliderValue, GoalkeepingMaxSliderValue;
    GoalkeepingMinSliderValue = document.getElementById(Prefix + "GoalkeepingMinTextBox").value;
    GoalkeepingMaxSliderValue = document.getElementById(Prefix + "GoalkeepingMaxTextBox").value;
    var PositionMinSliderValue, PositionMaxSliderValue;
    PositionMinSliderValue = document.getElementById(Prefix + "PositioningMinTextBox").value;
    PositionMaxSliderValue = document.getElementById(Prefix + "PositioningMaxTextBox").value;
    var StaminaMinSliderValue, StaminaMaxSliderValue;
    StaminaMinSliderValue = document.getElementById(Prefix + "StaminaMinTextBox").value;
    StaminaMaxSliderValue = document.getElementById(Prefix + "StaminaMaxTextBox").value;
    var PowerMinSliderValue, PowerMaxSliderValue;
    PowerMinSliderValue = document.getElementById(Prefix + "PowerMinTextBox").value;
    PowerMaxSliderValue = document.getElementById(Prefix + "PowerMaxTextBox").value;
    var TacklingMinSliderValue, TacklingMaxSliderValue;
    TacklingMinSliderValue = document.getElementById(Prefix + "TacklingMinTextBox").value;
    TacklingMaxSliderValue = document.getElementById(Prefix + "TacklingMaxTextBox").value;
    var HeadingMinSliderValue, HeadingMaxSliderValue;
    HeadingMinSliderValue = document.getElementById(Prefix + "HeadingMinTextBox").value;
    HeadingMaxSliderValue = document.getElementById(Prefix + "HeadingMaxTextBox").value;
    var QuicknessMinSliderValue, QuicknessMaxSliderValue;
    QuicknessMinSliderValue = document.getElementById(Prefix + "QuicknessMinTextBox").value;
    QuicknessMaxSliderValue = document.getElementById(Prefix + "QuicknessMaxTextBox").value;
    var TechniqueMinSliderValue, TechniqueMaxSliderValue;
    TechniqueMinSliderValue = document.getElementById(Prefix + "TechniqueMinTextBox").value;
    TechniqueMaxSliderValue = document.getElementById(Prefix + "TechniqueMaxTextBox").value;
    var ShortPassingMinSliderValue, ShortPassingMaxSliderValue;
    ShortPassingMinSliderValue = document.getElementById(Prefix + "ShortPassingMinTextBox").value;
    ShortPassingMaxSliderValue = document.getElementById(Prefix + "ShortPassingMaxTextBox").value;
    var LongPassingMinSliderValue, LongPassingMaxSliderValue;
    LongPassingMinSliderValue = document.getElementById(Prefix + "LongPassingMinTextBox").value;
    LongPassingMaxSliderValue = document.getElementById(Prefix + "LongPassingMaxTextBox").value;
    var ShootingMinSliderValue, ShootingMaxSliderValue;
    ShootingMinSliderValue = document.getElementById(Prefix + "ShootingMinTextBox").value;
    ShootingMaxSliderValue = document.getElementById(Prefix + "ShootingMaxTextBox").value;
    var CharismaMinSliderValue, CharismaMaxSliderValue;
    CharismaMinSliderValue = document.getElementById(Prefix + "CharismaMinTextBox").value;
    CharismaMaxSliderValue = document.getElementById(Prefix + "CharismaMaxTextBox").value;
    var ExperienceMinSliderValue, ExperienceMaxSliderValue;
    ExperienceMinSliderValue = document.getElementById(Prefix + "ExperienceMinTextBox").value;
    ExperienceMaxSliderValue = document.getElementById(Prefix + "ExperienceMaxTextBox").value;
    var AgeMinSliderValue, AgeMaxSliderValue;
    AgeMinSliderValue = document.getElementById(Prefix + "AgeMinTextBox").value;
    AgeMaxSliderValue = document.getElementById(Prefix + "AgeMaxTextBox").value;

    $("#InstinctsSlider").slider({
        range: true,
        values: [InstinctsMinSliderValue, InstinctsMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#InstinctsSlider").slider("option", "values");
            Get(Prefix + "InstinctsMinTextBox").value = Values[0];
            Get(Prefix + "InstinctsMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#InstinctsSlider").slider("option", "values");
            Get(Prefix + "InstinctsMinTextBox").value = Values[0];
            Get(Prefix + "InstinctsMaxTextBox").value = Values[1];
        }
    });

    $("#GoalkeepingSlider").slider({
        range: true,
        values: [GoalkeepingMinSliderValue, GoalkeepingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#GoalkeepingSlider").slider("option", "values");
            Get(Prefix + "GoalkeepingMinTextBox").value = Values[0];
            Get(Prefix + "GoalkeepingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#GoalkeepingSlider").slider("option", "values");
            Get(Prefix + "GoalkeepingMinTextBox").value = Values[0];
            Get(Prefix + "GoalkeepingMaxTextBox").value = Values[1];
        }
    });

    $("#PositioningSlider").slider({
        range: true,
        values: [PositionMinSliderValue, PositionMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#PositioningSlider").slider("option", "values");
            Get(Prefix + "PositioningMinTextBox").value = Values[0];
            Get(Prefix + "PositioningMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#PositioningSlider").slider("option", "values");
            Get(Prefix + "PositioningMinTextBox").value = Values[0];
            Get(Prefix + "PositioningMaxTextBox").value = Values[1];
        }
    });
    $("#StaminaSlider").slider({
        range: true,
        values: [StaminaMinSliderValue, StaminaMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#StaminaSlider").slider("option", "values");
            Get(Prefix + "StaminaMinTextBox").value = Values[0];
            Get(Prefix + "StaminaMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#StaminaSlider").slider("option", "values");
            Get(Prefix + "StaminaMinTextBox").value = Values[0];
            Get(Prefix + "StaminaMaxTextBox").value = Values[1];
        }
    });
    $("#PowerSlider").slider({
        range: true,
        values: [PowerMinSliderValue, PowerMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#PowerSlider").slider("option", "values");
            Get(Prefix + "PowerMinTextBox").value = Values[0];
            Get(Prefix + "PowerMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#PowerSlider").slider("option", "values");
            Get(Prefix + "PowerMinTextBox").value = Values[0];
            Get(Prefix + "PowerMaxTextBox").value = Values[1];
        }
    });
    $("#TacklingSlider").slider({
        range: true,
        values: [TacklingMinSliderValue, TacklingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#TacklingSlider").slider("option", "values");
            Get(Prefix + "TacklingMinTextBox").value = Values[0];
            Get(Prefix + "TacklingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#TacklingSlider").slider("option", "values");
            Get(Prefix + "TacklingMinTextBox").value = Values[0];
            Get(Prefix + "TacklingMaxTextBox").value = Values[1];
        }
    });
    $("#HeadingSlider").slider({
        range: true,
        values: [HeadingMinSliderValue, HeadingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#HeadingSlider").slider("option", "values");
            Get(Prefix + "HeadingMinTextBox").value = Values[0];
            Get(Prefix + "HeadingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#HeadingSlider").slider("option", "values");
            Get(Prefix + "HeadingMinTextBox").value = Values[0];
            Get(Prefix + "HeadingMaxTextBox").value = Values[1];
        }
    });
    $("#QuicknessSlider").slider({
        range: true,
        values: [QuicknessMinSliderValue, QuicknessMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#QuicknessSlider").slider("option", "values");
            Get(Prefix + "QuicknessMinTextBox").value = Values[0];
            Get(Prefix + "QuicknessMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#QuicknessSlider").slider("option", "values");
            Get(Prefix + "QuicknessMinTextBox").value = Values[0];
            Get(Prefix + "QuicknessMaxTextBox").value = Values[1];
        }
    });
    $("#TechniqueSlider").slider({
        range: true,
        values: [TechniqueMinSliderValue, TechniqueMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#TechniqueSlider").slider("option", "values");
            Get(Prefix + "TechniqueMinTextBox").value = Values[0];
            Get(Prefix + "TechniqueMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#TechniqueSlider").slider("option", "values");
            Get(Prefix + "TechniqueMinTextBox").value = Values[0];
            Get(Prefix + "TechniqueMaxTextBox").value = Values[1];
        }
    });
    $("#ShortPassingSlider").slider({
        range: true,
        values: [ShortPassingMinSliderValue, ShortPassingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#ShortPassingSlider").slider("option", "values");
            Get(Prefix + "ShortPassingMinTextBox").value = Values[0];
            Get(Prefix + "ShortPassingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#ShortPassingSlider").slider("option", "values");
            Get(Prefix + "ShortPassingMinTextBox").value = Values[0];
            Get(Prefix + "ShortPassingMaxTextBox").value = Values[1];
        }
    });
    $("#LongPassingSlider").slider({
        range: true,
        values: [LongPassingMinSliderValue, LongPassingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#LongPassingSlider").slider("option", "values");
            Get(Prefix + "LongPassingMinTextBox").value = Values[0];
            Get(Prefix + "LongPassingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#LongPassingSlider").slider("option", "values");
            Get(Prefix + "LongPassingMinTextBox").value = Values[0];
            Get(Prefix + "LongPassingMaxTextBox").value = Values[1];
        }
    });
    $("#ShootingSlider").slider({
        range: true,
        values: [ShootingMinSliderValue, ShootingMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#ShootingSlider").slider("option", "values");
            Get(Prefix + "ShootingMinTextBox").value = Values[0];
            Get(Prefix + "ShootingMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#ShootingSlider").slider("option", "values");
            Get(Prefix + "ShootingMinTextBox").value = Values[0];
            Get(Prefix + "ShootingMaxTextBox").value = Values[1];
        }
    });
    $("#CharismaSlider").slider({
        range: true,
        values: [CharismaMinSliderValue, CharismaMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#CharismaSlider").slider("option", "values");
            Get(Prefix + "CharismaMinTextBox").value = Values[0];
            Get(Prefix + "CharismaMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#CharismaSlider").slider("option", "values");
            Get(Prefix + "CharismaMinTextBox").value = Values[0];
            Get(Prefix + "CharismaMaxTextBox").value = Values[1];
        }
    });
    $("#ExperienceSlider").slider({
        range: true,
        values: [ExperienceMinSliderValue, ExperienceMaxSliderValue],
        min: 0,
        max: 100,
        slide: function (event, ui) {
            var Values = $("#ExperienceSlider").slider("option", "values");
            Get(Prefix + "ExperienceMinTextBox").value = Values[0];
            Get(Prefix + "ExperienceMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#ExperienceSlider").slider("option", "values");
            Get(Prefix + "ExperienceMinTextBox").value = Values[0];
            Get(Prefix + "ExperienceMaxTextBox").value = Values[1];
        }
    });
    $("#AgeSlider").slider({
        range: true,
        values: [AgeMinSliderValue, AgeMaxSliderValue],
        min: 16,
        max: 40,
        slide: function (event, ui) {
            var Values = $("#AgeSlider").slider("option", "values");
            Get(Prefix + "AgeMinTextBox").value = Values[0];
            Get(Prefix + "AgeMaxTextBox").value = Values[1];
        },
        stop: function (event, ui) {
            var Values = $("#AgeSlider").slider("option", "values");
            Get(Prefix + "AgeMinTextBox").value = Values[0];
            Get(Prefix + "AgeMaxTextBox").value = Values[1];
        }
    });
})